/**
 * <p>Title: InnerSingleton.java>
 * <p>Description: 单例模式内部类实现
 * <p>Company: YSS
 * @author yangsongsong
 * @date 2018年12月31日
 */
package com.yss.singleton;

public class InnerSingleton {
	/**
	 * 内部类实现单利模式 延迟加载，减少内存开销
	 */
	private static class SingletonHolder {
		private static InnerSingleton instance = new InnerSingleton();
	}

	private InnerSingleton() {
	}

	public static InnerSingleton getInstance() {
		return SingletonHolder.instance;
	}

	public void method() {
		System.out.println("InnerSingleton");
	}
}
